package com.semeureka.fault.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.semeureka.fault.bean.Group;
import com.semeureka.fault.dao.GroupDao;
import com.semeureka.fault.service.GroupService;

@Component
@Transactional
public class GroupServiceImpl implements GroupService {
	@Autowired
	private GroupDao groupDao;

	@Override
	@Cacheable(value = "groups", key = "T(com.semeureka.frame.util.HexUtils).toHex(#hostCode)")
	public Group findByHostCode(byte[] hostCode) {
		return groupDao.findByHostCode(hostCode);
	}

	@Override
	public Group findByGroupNumber(Group group, Integer number) {
		return groupDao.findByGroupNumber(group, number);
	}
}
